

use "C:\Users\Patrick Shea\Dropbox\My Projects\Default and Heirachy\Empirical Analysis\Data\JCR_replication.dta", clear



**********************************************************
**Appendix
********************************************

**********************************************************
**Section A Sample of Countries
**********************************************************

logit rescase usa_median i.ccode if oecd!=1, cluster(ccode)
tab ccode if e(sample)

xtreg annualJPspread    c.usa_median  if oecd!=1, i(ccode) fe 
tab ccode if e(sample)

**********************************************************
**Section J IMF
***********************************************************


xtset ccode year

cap drop yr08
 gen yr08 = (year==2008 |year==2009)

gen lnBA2TOT = ln(BA2TOT+1)

gen lnIMFcreditsUSD = ln(dt_dod_dimf+1)
replace  lnIMFcreditsUSD = 0 if  lnIMFcreditsUSD==. 

replace restruct_ongoing = 0 if restruct_ongoing==. & year >1975


 gen imfiv = liquidityratio*proportion_x_1
 gen i = FEDFUNDS*Echelon2
	tab year, g(yr_)
	tab ccode, g(cc_)
	
	btscs imfcredit year ccode, gen(iyrs)
	gen i2 = iyrs* iyrs
	gen i3 = (i2*iyrs)/10000







	
	 xtreg F.imfcredit c.usa_median ///
rightlead lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1, i(ccode) fe 	
		estimates store i1

	
		 xtreg F.lnIMFcreditsUSD c.usa_median ///
rightlead lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1, i(ccode) fe 	

 xtreg F.max_IMFprgm c.usa_median rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 , i(ccode) fe 
		estimates store i2
 
 xtreg F.lnBA2TOT c.usa_median rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1 &  max_IMFprgm==1, i(ccode) fe 
			estimates store i3

 xtreg F.W1 c.usa_median ///
rightlead lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1   &  max_IMFprgm==1, i(ccode) fe 	
		estimates store i4

lab var yr08  "Financial Crisis"
 
estout i1 i2 i3 i4, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) starlevels(* 0.10 ** 0.05) ///
stats(r2 N, fmt(%9.2f %9.0f) labels("R2" ))  style(tex) ///
legend label collabels(none) varlabels(_cons Constant) ///
order(usa_median) drop(_cons  )
 
 
 
	 xtreg annualJPspread imfcredit c.usa_median ///
rightlead lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1, i(ccode) fe 	
		estimates store i1
	

 xtreg annualJPspread max_IMFprgm c.usa_median rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 , i(ccode) fe 
		estimates store i2
 
 xtreg annualJPspread lnBA2TOT c.usa_median rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1 & max_IMFprgm==1, i(ccode) fe 
			estimates store i3

 xtreg annualJPspread W1 c.usa_median ///
rightlead lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1  & max_IMFprgm==1, i(ccode) fe 	
		estimates store i4

lab var max_IMFprgm  "IMF Program"

lab var BA2TOT  "Conditions"
lab var lnBA2TOT  "Conditions"

 lab var W1  "Waivers"

estout i1 i2 i3 i4, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) starlevels(* 0.10 ** 0.05) ///
stats(r2 N, fmt(%9.2f %9.0f) labels("R2" ))  style(tex) ///
legend label collabels(none) varlabels(_cons Constant) ///
order(usa_median imfcredit max_IMFprgm lnBA2TOT  W1 ) drop(_cons  )
  
 
 
 	 xtreg annualJPspread imfcredit c.usa_median ///
rightlead lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08  if restruct_ongoing!=1 & yrsHC3>=1 & yrsHC!=., i(ccode) fe 	
	

 xtreg annualJPspread max_IMFprgm c.usa_median rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08  if restruct_ongoing!=1 & yrsHC3>=1 & yrsHC!=., i(ccode) fe 
 
 xtreg annualJPspread BA2TOT c.usa_median rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08  if restruct_ongoing!=1 & yrsHC3>=1 & yrsHC!=., i(ccode) fe 

 xtreg annualJPspread W1 c.usa_median ///
rightlead lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08  if restruct_ongoing!=1 & yrsHC3>=1 & yrsHC!=., i(ccode) fe 	
 
 
 
 **********************************************************
**Section  K Bilitaral Financial Flow
***********************************************************
 

 
 cap drop yr08
 gen yr08 = (year==2008 |year==2009)

 
 xtset ccode year
reg US_bilateral_bailout c.usa_median rightlead lngdppc_wdi v2x_polyarchy ny_gdp_totl_rt_zs 
		estimates store b1

 	 xtreg F.log_us_econaid log_us_econaid c.usa_median  /// 
 rightlead lngdppc_wdi v2x_polyarchy ny_gdp_totl_rt_zs , i(ccode) fe 
 
	 xtreg F.log_us_econaid c.usa_median  /// 
 rightlead lngdppc_wdi v2x_polyarchy ny_gdp_totl_rt_zs , i(ccode) fe 	 
		estimates store b2


  
  
	 xtreg annualJPspread log_us_econaid c.usa_median ///
imfcredit rightlead lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1, i(ccode) fe 	
 		estimates store b2a

reg F.log_us_econaid c.usa_median  /// 
 rightlead lngdppc_wdi v2x_polyarchy ny_gdp_totl_rt_zs cc_*	 
		estimates store m2


  
  
reg annualJPspread log_us_econaid c.usa_median ///
imfcredit rightlead lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 cc_*	 if oecd!=1	
 		estimates store  m2a
		
		
		

 suest m2 m2a
nlcom (_b[m2_mean:usa_median] * _b[m2a_mean:log_us_econaid])

		
		
		
 	 xtreg F.lnmilaid c.usa_median  /// 
 rightlead lngdppc_wdi v2x_polyarchy ny_gdp_totl_rt_zs , i(ccode) fe 	 
		estimates store b3
		
		 	 xtreg F.lnmilaid lnmilaid c.usa_median  /// 
 rightlead lngdppc_wdi v2x_polyarchy ny_gdp_totl_rt_zs , i(ccode) fe 	 

 

	 xtreg annualJPspread lnmilaid  c.usa_median ///
imfcredit rightlead lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1, i(ccode) fe 	
 		estimates store b3a
		
	reg F.lnmilaid c.usa_median  /// 
 rightlead lngdppc_wdi v2x_polyarchy ny_gdp_totl_rt_zs cc_*	 
		estimates store m3


  
  
reg annualJPspread lnmilaid c.usa_median ///
imfcredit rightlead lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 cc_*	 if oecd!=1	
 		estimates store  m3a
		
		
		

 suest m3 m3a
nlcom (_b[m3_mean:usa_median] * _b[m3a_mean:lnmilaid])
	
		

 
gen lnBA_stock = ln(BA_stock)

replace lnBA_stock = 0 if lnBA_stock==. & year >=1970

 gen pdBA_stock = d.BA_stock/l.BA_stock
 
   	 xtreg  F.lnBA_stock  c.usa_median ///
 rightlead lngdppc_wdi v2x_polyarchy ny_gdp_totl_rt_zs , i(ccode) fe 	 
 		estimates store b4

 
  	 xtreg annualJPspread lnBA_stock c.usa_median ///
imfcredit rightlead lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1, i(ccode) fe 	
estimates store b4a

lab var log_us_econaid "log US Econ Aid"
lab var lnmilaid  "log US Military Aid"
lab var lnBA_stock  "log US debt stock"

estout b1 b2 b2a b3 b3a b4 b4a, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) starlevels(* 0.10 ** 0.05) ///
stats(r2 N, fmt(%9.2f %9.0f) labels("R2" ))  style(tex) ///
legend label collabels(none) varlabels(_cons Constant) ///
order(usa_median log_us_econaid lnmilaid lnBA_stock) drop(_cons imfcredit rightlead lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08  )
  






**********************************************************
**Section  G Components Individuals: Restructuring
***********************************************************
lab var log_us_arms "log US Arms"
lab var us_ex "US Exercise"
lab var us_pact "US Pact"
lab var log_us_troops "log US troops"
lab var  us_vis "US Visit"
lab var  log_us_words "log US Words"

global cntl imfcredit rightlead lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP ny_gdp_totl_rt_zs v2x_polyarchy ryrs r2 r3



logit rescase log_us_arms $cntl i.ccode if oecd!=1, cluster(ccode)
estimates store c1

logit rescase us_arms $cntl i.ccode if oecd!=1, cluster(ccode)
estimates store c1a

logit rescase us_ex $cntl i.ccode if oecd!=1, cluster(ccode)
estimates store c2

logit rescase us_pact $cntl i.ccode if oecd!=1, cluster(ccode)
estimates store c4

logit rescase log_us_troops $cntl i.ccode if oecd!=1, cluster(ccode)
estimates store c5

logit rescase us_troops $cntl i.ccode if oecd!=1, cluster(ccode)
estimates store c5a

logit rescase us_vis $cntl i.ccode  if oecd!=1, cluster(ccode)
estimates store c6

logit rescase log_us_words $cntl i.ccode if oecd!=1, cluster(ccode)
estimates store c7

logit rescase us_words $cntl i.ccode if oecd!=1, cluster(ccode)
estimates store c7a

logit rescase log_us_arms us_ex us_pact log_us_troops us_vis log_us_words $cntl i.ccode if oecd!=1, cluster(ccode)
estimates store c8

estout c1 c2 c4 c5 c6 c7 c8, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) starlevels(* 0.10 ** 0.05) ///
stats(ll N r2, fmt(%9.2f %9.0f) labels("Log-Like" ))  style(tex) ///
legend label collabels(none) varlabels(_cons Constant) ///
order(log_us_arms us_ex us_pact log_us_troops us_vis log_us_words) drop(r2 r3 *ccode ) 

**********************************************************
**Section  G Components Individuals: Default
***********************************************************

logit default3 log_us_arms $cntl i.ccode if oecd!=1, cluster(ccode)
estimates store c1

logit default3 us_arms $cntl i.ccode if oecd!=1, cluster(ccode)
estimates store c1a

logit default3 us_ex $cntl i.ccode if oecd!=1, cluster(ccode)
estimates store c2

logit default3 us_pact $cntl i.ccode if oecd!=1, cluster(ccode)
estimates store c4

logit default3 log_us_troops $cntl i.ccode if oecd!=1, cluster(ccode)
estimates store c5

logit default3 us_troops $cntl i.ccode if oecd!=1, cluster(ccode)
estimates store c5a

logit default3 us_vis $cntl i.ccode  if oecd!=1, cluster(ccode)
estimates store c6

logit default3 log_us_words $cntl i.ccode if oecd!=1, cluster(ccode)
estimates store c7

logit default3 us_words $cntl i.ccode if oecd!=1, cluster(ccode)
estimates store c7a

logit default3 log_us_arms us_ex us_pact log_us_troops us_vis log_us_words $cntl i.ccode if oecd!=1, cluster(ccode)
estimates store c8

estout c1 c2 c4 c5 c6 c7 c8, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) starlevels(* 0.10 ** 0.05) ///
stats(ll N r2, fmt(%9.2f %9.0f) labels("Log-Like" ))  style(tex) ///
legend label collabels(none) varlabels(_cons Constant) ///
order(log_us_arms us_ex us_pact log_us_troops us_vis log_us_words) drop(r2 r3 *ccode )


**********************************************************
**Section  G Components Individuals: Reentry
*****************************************************
******
stset wanted, id(ccode)  failure(anyissue==1)

stcox usa_median W1 rightlead lngdppc_wdi v2x_polyarchy, nohr cluster(ccode)
estimates store s1

stcox  us_ex imfcredit rightlead lngdppc_wdi v2x_polyarchy, nohr cluster(ccode)
estimates store s2

stcox  us_pact  imfcredit rightlead lngdppc_wdi v2x_polyarchy, nohr cluster(ccode)
estimates store s3

stcox  log_us_troops  imfcredit rightlead lngdppc_wdi v2x_polyarchy, nohr cluster(ccode)
estimates store s4

stcox us_vis  imfcredit rightlead lngdppc_wdi v2x_polyarchy, nohr cluster(ccode)
estimates store s5

stcox log_us_words imfcredit rightlead lngdppc_wdi v2x_polyarchy, nohr cluster(ccode)
estimates store s6


stcox log_us_arms us_ex us_pact log_us_troops us_vis log_us_words imfcredit rightlead lngdppc_wdi v2x_polyarchy, nohr cluster(ccode)
estimates store s7

estout s1 s2 s3 s4 s5 s6 s7, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) starlevels(* 0.10 ** 0.05) ///
stats(ll N r2, fmt(%9.2f %9.0f) labels("Log-Like" ))  style(tex) ///
legend label collabels(none) varlabels(_cons Constant) ///
order(log_us_arms us_ex us_pact log_us_troops us_vis log_us_words) drop( imfcredit rightlead lngdppc_wdi v2x_polyarchy)


**********************************************************
**Section  G Components Individuals: Bond Yields Full Sample
**********************************************************
xtset ccode year

 gen yr08 = (year==2008 |year==2009)

xtreg annualJPspread  log_us_arms imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 , i(ccode) fe 
estimates store b1

xtreg annualJPspread   us_ex imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 , i(ccode) fe 
estimates store b2


xtreg annualJPspread   us_pact imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 , i(ccode) fe 
estimates store b3


xtreg annualJPspread  log_us_troops imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 , i(ccode) fe 
estimates store b4


xtreg annualJPspread  us_vis imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 , i(ccode) fe 
estimates store b5


xtreg annualJPspread  log_us_words imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 , i(ccode) fe 
estimates store b6

xtreg annualJPspread  log_us_arms us_ex us_pact log_us_troops us_vis log_us_words imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 , i(ccode) fe 
estimates store b7


estout b1 b2 b3 b4 b5 b6 b7, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) starlevels(* 0.10 ** 0.05) ///
stats(r2 N, fmt(%9.2f %9.0f) labels("R2" ))  style(tex) ///
legend label collabels(none) varlabels(_cons Constant) ///
order(log_us_arms us_ex us_pact log_us_troops us_vis log_us_words) drop(imfcredit  rightlead lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08) 

**********************************************************
**Section  G Components Individuals: Bond Yields Post-Restructuring Sample
**********************************************************
xtset ccode year

xtreg annualJPspread  log_us_arms imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1 & restruct_ongoing!=1 & yrsHC3>=1 & yrsHC!=., i(ccode) fe 
estimates store b1

xtreg annualJPspread   us_ex imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1 & restruct_ongoing!=1 & yrsHC3>=1 & yrsHC!=., i(ccode) fe 
estimates store b2


xtreg annualJPspread   us_pact imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1 & restruct_ongoing!=1 & yrsHC3>=1 & yrsHC!=., i(ccode) fe 
estimates store b3


xtreg annualJPspread  log_us_troops imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1 & restruct_ongoing!=1 & yrsHC3>=1 & yrsHC!=., i(ccode) fe 
estimates store b4


xtreg annualJPspread  us_vis imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1 & restruct_ongoing!=1 & yrsHC3>=1 & yrsHC!=., i(ccode) fe 
estimates store b5


xtreg annualJPspread  log_us_words imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1 & restruct_ongoing!=1 & yrsHC3>=1 & yrsHC!=., i(ccode) fe 
estimates store b6

xtreg annualJPspread  log_us_arms us_ex us_pact log_us_troops us_vis log_us_words imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1 & restruct_ongoing!=1 & yrsHC3>=1 & yrsHC!=., i(ccode) fe 
estimates store b7


estout b1 b2 b3 b4 b5 b6 b7, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) starlevels(* 0.10 ** 0.05) ///
stats(r2 N, fmt(%9.2f %9.0f) labels("R2" ))  style(tex) ///
legend label collabels(none) varlabels(_cons Constant) ///
order(log_us_arms us_ex us_pact log_us_troops us_vis log_us_words) drop(imfcredit  rightlead lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08) 


**********************************************************
**Section  G Components Individuals: Bond Yields 1-7 years Post-Restructuring Sample
**********************************************************
xtset ccode year

xtreg annualJPspread  log_us_arms imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1 & restruct_ongoing!=1 & yrsHC>=1 & yrsHC <8, i(ccode) fe 
estimates store b1

xtreg annualJPspread   us_ex imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1 & restruct_ongoing!=1 & yrsHC>=1 & yrsHC <8, i(ccode) fe 
estimates store b2


xtreg annualJPspread   us_pact imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1 & restruct_ongoing!=1 & yrsHC>=1 & yrsHC <8, i(ccode) fe 
estimates store b3


xtreg annualJPspread  log_us_troops imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1 & restruct_ongoing!=1 & yrsHC>=1 & yrsHC <8, i(ccode) fe 
estimates store b4


xtreg annualJPspread  us_vis imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1 & restruct_ongoing!=1 & yrsHC>=1 & yrsHC <8, i(ccode) fe 
estimates store b5


xtreg annualJPspread  log_us_words imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1 & restruct_ongoing!=1 & yrsHC>=1 & yrsHC <8, i(ccode) fe 
estimates store b6

xtreg annualJPspread  log_us_arms us_ex us_pact log_us_troops us_vis log_us_words imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1 & restruct_ongoing!=1 & yrsHC>=1 & yrsHC <8, i(ccode) fe 
estimates store b7


estout b1 b2 b3 b4 b5 b6 b7, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) starlevels(* 0.10 ** 0.05) ///
stats(r2 N, fmt(%9.2f %9.0f) labels("R2" ))  style(tex) ///
legend label collabels(none) varlabels(_cons Constant) ///
order(log_us_arms us_ex us_pact log_us_troops us_vis log_us_words) drop(imfcredit  rightlead lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08) 


**********************************************************
**Section  I  Controlling for Conflict. 
**********************************************************

global cntl imfcredit rightlead lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP ny_gdp_totl_rt_zs v2x_polyarchy ryrs r2 r3



logit rescase usa_median max_anycon $cntl i.ccode if oecd!=1, cluster(ccode)
estimates store c8

logit default3 usa_median max_anycon $cntl i.ccode if oecd!=1, cluster(ccode)
estimates store c8a

stset wanted, id(ccode)  failure(anyissue==1)

stcox usa_median max_anycon imfcredit rightlead  lntrade_wdi debtGDP ny_gdp_totl_rt_zs lngdppc_wdi v2x_polyarchy, nohr cluster(ccode)

estimates store s8


xtreg annualJPspread  usa_median max_anycon imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 , i(ccode) fe 
estimates store b7


xtreg annualJPspread  usa_median max_anycon imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1 & restruct_ongoing!=1 & yrsHC3>=1 & yrsHC!=., i(ccode) fe 
estimates store b8


xtreg annualJPspread  usa_median max_anycon imfcredit  rightlead ///
lngdppc_wdi lngdp_wdi lntrade_wdi debtGDP v2x_polyarchy   ny_gdp_totl_rt_zs yr08 if oecd!=1 & restruct_ongoing!=1 & yrsHC>=1 & yrsHC <8 , i(ccode) fe 
estimates store b9


lab var max_anycon "Conflict"

estout c8 c8a s8 b7 b8 b9, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) starlevels(* 0.10 ** 0.05) ///
stats(ll r2 N, fmt(%9.2f %9.2f %9.0f )  labels("Log-Like" ))  style(tex) ///
legend label collabels(none) varlabels(_cons Constant) ///
order(usa_median max_anycon) drop(r2 r3 *ccode )


**********************************************************
**Section L Fiscal Balance Mechs
**********************************************************


    xtreg pby l.pby l.usa_median usa_median  rightlead ///
        lngdppc_wdi lngdp_wdi lntrade_wdi v2x_polyarchy ///
        ny_gdp_totl_rt_zs i.year if oecd != 1, i(ccode) fe
estimates store m1a
		
	 xtreg fby l.fby l.usa_median usa_median  rightlead ///
        lngdppc_wdi lngdp_wdi lntrade_wdi v2x_polyarchy ///
        ny_gdp_totl_rt_zs i.year if oecd != 1, i(ccode) fe
estimates store m1

	 xtreg gc_rev_xgrt_gd_zs l.gc_rev_xgrt_gd_zs l.usa_median usa_median  rightlead ///
        lngdppc_wdi lngdp_wdi lntrade_wdi v2x_polyarchy ///
        ny_gdp_totl_rt_zs i.year if oecd != 1, i(ccode) fe
estimates store m2

	 xtreg gc_xpn_gsrv_zs l.gc_xpn_gsrv_zs l.usa_median usa_median  rightlead ///
        lngdppc_wdi lngdp_wdi lntrade_wdi v2x_polyarchy ///
        ny_gdp_totl_rt_zs i.year if oecd != 1, i(ccode) fe
	estimates store m3


	xtreg pa_nus_fcrf	 l.pa_nus_fcrf	 l.usa_median usa_median  rightlead ///
        lngdppc_wdi lngdp_wdi lntrade_wdi v2x_polyarchy ///
        ny_gdp_totl_rt_zs i.year if oecd != 1, i(ccode) fe
estimates store m4
				
	xtreg px_rex_reer l.px_rex_reer	 l.usa_median usa_median  rightlead ///
        lngdppc_wdi lngdp_wdi lntrade_wdi v2x_polyarchy ///
        ny_gdp_totl_rt_zs i.year if oecd != 1, i(ccode) fe
	estimates store m5
		
	xtreg 	fi_res_totl_mo l.fi_res_totl_mo l.usa_median usa_median  rightlead ///
        lngdppc_wdi lngdp_wdi lntrade_wdi v2x_polyarchy ///
        ny_gdp_totl_rt_zs i.year if oecd != 1, i(ccode) fe
	estimates store m6
	
		xtreg 	prdebty l.prdebty l.usa_median usa_median  rightlead ///
        lngdppc_wdi lngdp_wdi lntrade_wdi v2x_polyarchy ///
        ny_gdp_totl_rt_zs i.year if oecd != 1, i(ccode) fe
	estimates store m7
	
				xtreg ny_gdp_defl_kd_zg l.ny_gdp_defl_kd_zg l.usa_median  usa_median  rightlead ///
        lngdppc_wdi lngdp_wdi lntrade_wdi v2x_polyarchy ///
        ny_gdp_totl_rt_zs i.year if oecd != 1, i(ccode) fe
	estimates store m8

estout m1 m1a m2 m3 m4 m5 m6 m7 m8, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) starlevels(* 0.10 ** 0.05) ///
stats(ll r2 N, fmt(%9.2f %9.2f %9.0f )  labels("Log-Like" ))  style(tex) ///
legend label collabels(none) varlabels(_cons Constant) ///
keep(usa_median L.usa_median) order(usa_median L.usa_median)





    xtreg pby  usa_median  rightlead ///
        lngdppc_wdi lngdp_wdi lntrade_wdi v2x_polyarchy ///
        ny_gdp_totl_rt_zs i.year if oecd != 1, i(ccode) fe
estimates store m1a
		
	 xtreg fby  usa_median  rightlead ///
        lngdppc_wdi lngdp_wdi lntrade_wdi v2x_polyarchy ///
        ny_gdp_totl_rt_zs i.year if oecd != 1, i(ccode) fe
estimates store m1

	 xtreg gc_rev_xgrt_gd_zs  usa_median  rightlead ///
        lngdppc_wdi lngdp_wdi lntrade_wdi v2x_polyarchy ///
        ny_gdp_totl_rt_zs i.year if oecd != 1, i(ccode) fe
estimates store m2

	 xtreg gc_xpn_gsrv_zs  usa_median  rightlead ///
        lngdppc_wdi lngdp_wdi lntrade_wdi v2x_polyarchy ///
        ny_gdp_totl_rt_zs i.year if oecd != 1, i(ccode) fe
	estimates store m3


	xtreg pa_nus_fcrf usa_median  rightlead ///
        lngdppc_wdi lngdp_wdi lntrade_wdi v2x_polyarchy ///
        ny_gdp_totl_rt_zs i.year if oecd != 1, i(ccode) fe
estimates store m4
				
	xtreg px_rex_reer  usa_median  rightlead ///
        lngdppc_wdi lngdp_wdi lntrade_wdi v2x_polyarchy ///
        ny_gdp_totl_rt_zs i.year if oecd != 1, i(ccode) fe
	estimates store m5
		
	xtreg 	fi_res_totl_mo  usa_median  rightlead ///
        lngdppc_wdi lngdp_wdi lntrade_wdi v2x_polyarchy ///
        ny_gdp_totl_rt_zs i.year if oecd != 1, i(ccode) fe
	estimates store m6
	
		xtreg 	prdebty  usa_median  rightlead ///
        lngdppc_wdi lngdp_wdi lntrade_wdi v2x_polyarchy ///
        ny_gdp_totl_rt_zs i.year if oecd != 1, i(ccode) fe
	estimates store m7
	
		xtreg 	prdebty  usa_median  rightlead ///
        lngdppc_wdi lngdp_wdi lntrade_wdi v2x_polyarchy ///
        ny_gdp_totl_rt_zs i.year if oecd != 1, i(ccode) fe
	estimates store m7
	

	
			xtreg ny_gdp_defl_kd_zg  usa_median  rightlead ///
        lngdppc_wdi lngdp_wdi lntrade_wdi v2x_polyarchy ///
        ny_gdp_totl_rt_zs i.year if oecd != 1, i(ccode) fe
	estimates store m8
	
	
estout m1 m1a m2 m3 m4 m5 m6 m7, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) starlevels(* 0.10 ** 0.05) ///
stats(r2 N, fmt( %9.2f %9.0f )  labels("R2" ))  style(tex) ///
legend label collabels(none) varlabels(_cons Constant) ///
keep(usa_median  ) 




